/*
archer
study 1 analyses
*/

* load study1.dta

set scheme s1mono

//IVs

* treatments
tab fl_34_do

gen control=.
replace control=1 if fl_34_do=="Purecontrol"
tab control

gen trumpattack=.
replace trumpattack=1 if fl_34_do=="TrumpcriticizesFox"
tab trumpattack

gen foxtextdef=.
replace foxtextdef=1 if fl_34_do=="Foxresponds-transcript"
tab foxtextdef

gen foxviddef=.
replace foxviddef=1 if fl_34_do=="Foxresponds-video"
tab foxviddef


gen treatments=.
replace treatments=1 if control==1
replace treatments=2 if trumpattack==1
replace treatments=3 if foxtextdef==1
replace treatments=4 if foxviddef==1
tab treatments

drop if treatments==. //drop those who didn't have treatment
tab treatments

gen treatments2=.
replace treatments2=1 if control==1
replace treatments2=2 if trumpattack==1
replace treatments2=3 if foxtextdef==1|foxviddef==1
tab treatments2

* treatments for reg
gen DTattack=0
replace DTattack=1 if trumpattack==1
tab DTattack

gen FNCtextdef=0
replace FNCtextdef=1 if foxtextdef==1
tab FNCtextdef

gen FNCviddef=0
replace FNCviddef=1 if foxviddef==1
tab FNCviddef

gen defense=0
replace defense=1 if foxtextdef==1|foxviddef==1
tab defense

* PID
gen pid7=.
replace pid7=1 if dem==1
replace pid7=2 if dem==2
replace pid7=3 if ind==1
replace pid7=4 if ind==3|ind==4
replace pid7=5 if ind==2
replace pid7=6 if rep==2
replace pid7=7 if rep==1
tab pid7

recode pid7 (1 2 3 = 1 "Democrat")(5 6 7 = 0 "Republican")(else=.), gen(demgop)
tab demgop

// other demogs

* age
tab age2
gen age01=(age2-18)/(91-18)
tab age01

* news interest
tab newsint
recode newsint(1=3 "Most of the time")(2=2 "Some of the time")(3=1 "Only now and then")(4=0 "Hardly at all")(else=.), gen(newsint01)
tab newsint01

* sex
tab sex
recode sex (1=0 "Male")(2=1 "Female")(else=.), gen(female)
tab female

* race 
tab race
recode race (5=0 "white")(1=1 "black")(3=2 "Hispanic")(2=3 "Asian")(else=.), gen(race4cat)
recode race4cat (1=1)(0 2 3=0)(else=.), gen(black) 
tab black
recode race4cat (2=1)(0 1 3=0)(else=.), gen(hisp) 
tab hisp
recode race4cat (3=1)(0 1 2=0)(else=.), gen(asian)
tab asian
recode race (1 2 3 4 6=1 "nonwhite")(5=0 "white")(else=.), gen(nonwhite)
tab nonwhite

gen native_amer=.
replace native_amer=1 if race==4
replace native_amer=0 if race!=4
tab native_amer 

gen white=. 
replace white=1 if race==5
replace white=0 if race!=5
tab white 

gen otherrace=.
replace otherrace=1 if race==6
replace otherrace=0 if race!=6
tab otherrace

* edu
tab edu
recode edu (1 2=0 "less HS")(3=.25)(4 5=.5)(6=.75)(7=1 "post BA")(else=.), gen(ed5cat)
tab ed5cat

* employment
recode employ (1 2 4 5 6 7 8 9=0)(3=1)(else=.), gen(unemployed)
tab unemployed

* video time spent
sum vidtime_pagesubmit if vidtime_pagesubmit<60
sum vidtime_pagesubmit if vidtime_pagesubmit>60

* text time spent
sum texttime_pagesubmit
sum texttime_pagesubmit if texttime_pagesubmit <60
sum texttime_pagesubmit if texttime_pagesubmit >60

gen complier=1
replace complier =0 if texttime_pagesubmit <60
replace complier =0 if vidtime_pagesubmit <60
tab complier

* how often watch fox news
tab watchfox
recode watchfox (1=1 "3+ per wk")(2=.75)(3=.5)(4=.25)(5=0 "Never")(else=.), gen(watchFNC)
tab watchFNC


by treatments2, sort: summarize pid7 ed5cat black hisp asian native_amer white otherrace age2 female state unemployed

by treatments2, sort: summarize favdt favbs newsint watchfox watchmsn

// DVs

* critical of Trump: higher values mean more critical of Trump
gen foxcrit1b=.
replace foxcrit1b=0 if foxcrit1==5
replace foxcrit1b=1 if foxcrit1==4
replace foxcrit1b=2 if foxcrit1==3
replace foxcrit1b=3 if foxcrit1==2
replace foxcrit1b=4 if foxcrit1==1
tab foxcrit1b

gen foxcrit2b=.
replace foxcrit2b=0 if foxcrit2==5
replace foxcrit2b=1 if foxcrit2==4
replace foxcrit2b=2 if foxcrit2==3
replace foxcrit2b=3 if foxcrit2==2
replace foxcrit2b=4 if foxcrit2==1
tab foxcrit2b

gen foxcrit3b=.
replace foxcrit3b=0 if foxcrit3==5
replace foxcrit3b=1 if foxcrit3==4
replace foxcrit3b=2 if foxcrit3==3
replace foxcrit3b=3 if foxcrit3==2
replace foxcrit3b=4 if foxcrit3==1
tab foxcrit3b

gen foxcrit4b=.
replace foxcrit4b=0 if foxcrit4==5
replace foxcrit4b=1 if foxcrit4==4
replace foxcrit4b=2 if foxcrit4==3
replace foxcrit4b=3 if foxcrit4==2
replace foxcrit4b=4 if foxcrit4==1
tab foxcrit4b

gen foxcritcombo=.
replace foxcritcombo=0 if foxcrit1b==0|foxcrit2b==0|foxcrit3b==0|foxcrit4b==0
replace foxcritcombo=1 if foxcrit1b==1|foxcrit2b==1|foxcrit3b==1|foxcrit4b==1
replace foxcritcombo=2 if foxcrit1b==2|foxcrit2b==2|foxcrit3b==2|foxcrit4b==2
replace foxcritcombo=3 if foxcrit1b==3|foxcrit2b==3|foxcrit3b==3|foxcrit4b==3
replace foxcritcombo=4 if foxcrit1b==4|foxcrit2b==4|foxcrit3b==4|foxcrit4b==4
tab foxcritcombo

gen foxcrit01=(foxcritcombo/4)
tab foxcrit01

sum foxcritcombo if treatments==1
sum foxcritcombo if treatments==2
sum foxcritcombo if treatments==3
sum foxcritcombo if treatments==4

recode foxcrit01 (0=1)(.25=.75)(.5=.5)(.75=.25)(1=0)(else=.), gen(foxcrit01rev)
tab foxcrit01rev

* loyal to trump: higher numbers mean more loyal to trump
recode foxloyal1 (1=4 "Extremely loyal")(2=3 "Very loyal")(3=2 "Somewhat loyal")(4=1 "Not very loyal")(5=0 "Not at all loyal")(else=.), gen(foxloyal1b)
tab foxloyal1b

recode foxloyal2 (1=4 "Extremely loyal")(2=3 "Very loyal")(3=2 "Somewhat loyal")(4=1 "Not very loyal")(5=0 "Not at all loyal")(else=.), gen(foxloyal2b)
tab foxloyal2b

recode foxloyal3 (1=4 "Extremely loyal")(2=3 "Very loyal")(3=2 "Somewhat loyal")(4=1 "Not very loyal")(5=0 "Not at all loyal")(else=.), gen(foxloyal3b)
tab foxloyal3b

recode foxloyal4 (1=4 "Extremely loyal")(2=3 "Very loyal")(3=2 "Somewhat loyal")(4=1 "Not very loyal")(5=0 "Not at all loyal")(else=.), gen(foxloyal4b)
tab foxloyal4b

gen foxloyalcombo=.
replace foxloyalcombo=0 if foxloyal1b==0|foxloyal2b==0|foxloyal3b==0|foxloyal4b==0
replace foxloyalcombo=1 if foxloyal1b==1|foxloyal2b==1|foxloyal3b==1|foxloyal4b==1
replace foxloyalcombo=2 if foxloyal1b==2|foxloyal2b==2|foxloyal3b==2|foxloyal4b==2
replace foxloyalcombo=3 if foxloyal1b==3|foxloyal2b==3|foxloyal3b==3|foxloyal4b==3
replace foxloyalcombo=4 if foxloyal1b==4|foxloyal2b==4|foxloyal3b==4|foxloyal4b==4
tab foxloyalcombo

gen foxloyal01=(foxloyalcombo/4)
tab foxloyal01

sum foxloyalcombo if treatments==1
sum foxloyalcombo if treatments==2
sum foxloyalcombo if treatments==3
sum foxloyalcombo if treatments==4

* evaluations of Fox being fair/political independent/objective: higher numbers means more objective/fair
tab foxfair
recode foxfair (1=4 "Strongly agree")(2=3 "Somewhat agree")(4=2 "Neither")(5=1 "Somewhat disagree")(7=0 "Strongly disagree")(else=.), gen(foxfairb)
tab foxfairb

tab foxind
recode foxind (1=4 "Strongly agree")(2=3 "Somewhat agree")(4=2 "Neither")(5=1 "Somewhat disagree")(7=0 "Strongly disagree")(else=.), gen(foxindb)
tab foxindb

tab foxobj
recode foxobj (1=4 "Strongly agree")(2=3 "Somewhat agree")(4=2 "Neither")(5=1 "Somewhat disagree")(7=0 "Strongly disagree")(else=.), gen(foxobjb)
tab foxobjb

alpha foxfairb foxindb foxobjb

gen foxfairbatt=(foxfairb+foxindb+foxobjb)/12
tab foxfairbatt

sum foxfairbatt if treatments==1
sum foxfairbatt if treatments==2
sum foxfairbatt if treatments==3
sum foxfairbatt if treatments==4

* fox's bias: higher numbers mean more conservative
tab fncbias
recode fncbias (1=0 "Extremely liberal")(2=1 "Somewhat liberal")(3=2 "Neither")(4=3 "Somewhat conservative")(5=4 "Extremely conservative")(else=.), gen(foxconserv)
tab foxconserv

gen foxconserv01=(foxconserv)/4
tab foxconserv01

sum foxconserv if treatments==1
sum foxconserv if treatments==2
sum foxconserv if treatments==3
sum foxconserv if treatments==4

* consume fox: higher numbers mean more likely to consume
tab consumefox
recode consumefox (1=4 "Extremely likely")(2=3 "Very likely")(3=2 "Somewhat likely")(4=1 "Not very likely")(5=0 "Not at all likely")(else=.), gen(consumefoxb)
tab consumefoxb

gen consumefox01=consumefoxb/4
tab consumefox01

sum consumefoxb if treatments==1
sum consumefoxb if treatments==2
sum consumefoxb if treatments==3
sum consumefoxb if treatments==4


************
* analyses *
************
mlogit treatments2 pid7 age01 female nonwhite ed5cat unemployed 

by treatments2, sort: summarize foxcrit01 foxconserv01 consumefox01 
by treatments2, sort: summarize foxcrit01 foxconserv01 consumefox01 if demgop==0
by treatments2, sort: summarize foxcrit01 foxconserv01 consumefox01 if demgop==1

****** Table 2 ******

// fox critical of trump
ttest foxcrit01 if treatments==1, by(demgop)

reg foxcrit01 DTattack defense  if demgop==0
lincom DTattack-defense

reg foxcrit01 DTattack defense  if demgop==1
lincom DTattack-defense

// fox's bias
ttest foxconserv01 if treatments==1, by(demgop)

reg foxconserv01 DTattack defense  if demgop==0
lincom DTattack-defense

reg foxconserv01 DTattack defense  if demgop==1
lincom DTattack-defense

// consume fox
ttest consumefox01 if treatments==1, by(demgop)

reg consumefox01 DTattack defense  if demgop==0
lincom DTattack-defense

reg consumefox01 DTattack defense  if demgop==1
lincom DTattack-defense

****** appendix  ******

* control for pre-stimulus DV
reg consumefox01 DTattack defense watchFNC if demgop==0
reg consumefox01 DTattack defense watchFNC if demgop==1

* pre-post Fox consumption
tab watchFNC,nol
gen watchFNCchange=consumefox01-watchFNC

by treatments2, sort: summarize watchFNC consumefox01 if demgop==0
by treatments2, sort: summarize watchFNC consumefox01 if demgop==1

reg watchFNCchange DTattack defense  if demgop==0
lincom _cons+DTattack 
lincom _cons+defense  
lincom DTattack-defense 
reg watchFNCchange DTattack defense  if demgop==1
lincom DTattack-defense 
lincom _cons+DTattack 
lincom _cons+defense  


* drop those who spent < 60 seconds on video [n=204 dropped] and text [n=421 dropped]

// fox critical of trump
reg foxcrit01 DTattack defense if demgop==0 & complier==1

reg foxcrit01 DTattack defense if demgop==1 & complier==1

// fox's bias
reg foxconserv01 DTattack defense if demgop==0 & complier==1

reg foxconserv01 DTattack defense if demgop==1 & complier==1

// consume fox
reg consumefox01 DTattack defense if demgop==0 & complier==1

reg consumefox01 DTattack defense if demgop==1 & complier==1


* separate defenses [add control for education]

// fox critical of trump
reg foxcrit01 DTattack FNCtextdef FNCviddef ed5cat if demgop==0

reg foxcrit01 DTattack FNCtextdef FNCviddef ed5cat if demgop==1

// fox's bias
reg foxconserv01 DTattack FNCtextdef FNCviddef ed5cat if demgop==0

reg foxconserv01 DTattack FNCtextdef FNCviddef ed5cat if demgop==1

// consume fox 
reg consumefox01 DTattack FNCtextdef FNCviddef ed5cat if demgop==0

reg consumefox01 DTattack FNCtextdef FNCviddef ed5cat if demgop==1

* additional DVs 

// loyalty to trump
reg foxloyal01 DTattack defense  if demgop==0
lincom DTattack-defense

reg foxloyal01 DTattack defense  if demgop==1
lincom DTattack-defense

// fairness and objectivity index
reg foxfairbatt DTattack defense  if demgop==0
lincom DTattack-defense

reg foxfairbatt DTattack defense  if demgop==1
lincom DTattack-defense

